package rule.rulechain;

import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.junit.rules.TestRule;

import static org.junit.Assert.assertTrue;

/**
 * Created by fengxiangxiang on 2016-10-14.
 */
public class UseRuleChainForAuto {
    @Rule
    public TestRule chain= RuleChain.
            outerRule (new DeleteFile("d:/test/JUnit410.txt")).
            around(new CreateFile("d:/test","JUnit410.txt")).
            around(new UpdateFile("ip=192.168.1.1","d:/test/JUnit410.txt"));
    //TestRule 实现三个步骤：
    //1. 删除已经存在的 Junit410.txt 文件
    //2. 创建新的 Junit410.txt 文件
    //3. 更新 IP 到 Junit410.txt 文件

    @Test
    public void example() {
        System.out.println("\n test started");
        assertTrue (true);
    }


}